package love.yuanmeng.guetcoalsystem.cotroller;

/*
 *   @Studio:CHJY · 源梦科技
 *   @Author:lzl
 *   @Ide:IntelliJ IDEA
 *   @Creation time:2021/10/17 11:20
 */

import love.yuanmeng.guetcoalsystem.service.UserInfoManageService;
import love.yuanmeng.guetcoalsystem.vo.RegisterVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin
@RestController
@RequestMapping("/userInfoManage")
public class UserInfoManageController {
    @Autowired
    UserInfoManageService userInfoManageService;

    @RequestMapping("/getUserInfo")
    public RegisterVo getUserInfo(String id){
        RegisterVo registerVo = userInfoManageService.doService(id);
        return registerVo;
    }

    @RequestMapping("/modifyInfo")
    public String modifyInfo(@RequestBody RegisterVo registerVo){
        int result = userInfoManageService.modifyInfo(registerVo);
        if(result==0) return "modify failed!";
        return "modify successfully!";
    }
}
